Class:  clCSVFile

Vers:   A00.0                                                  13 Dec 00

========================================================================
Provides a structure for modeling comma-separated variables ( CSV )
files.  Currently provides for reading ( connect method ), appending
records, inserting, replacing and deleting records and writing the
resultant data back to the original file ( commit method ).
Need to set the Path property first.

Known bugs:
creates an unitelligible error message ( array out of bounds ) if
replace, insert or delete ask for a non-existent line.


DISCLAIMER, WARRANTY AND COPYRIGHT
This example is provided on an 'as is' basis with no explicit or implied
warranty.  Copyright is retained by the author but free use including
copying and use for business purposes is expressly permitted.
========================================================================

Properties
==========
Path            text holding the absolute or relative path name of the
                CSV file.  Need to set this first.

TxtAry          text 2D array of fields extracted from each line, and
                all lines copied into 'records'.
========================================================================

Methods
=======
Text[] <NewData>  append void
-----------------------------
input   NewData         a one dimensional text array containing the new
                        data to be appended onto the end of the current
                        array.
                        
Append is a special case of insert where the new data is appended
automatically onto the end of the original data and then re-assigned to
the TxtAry property to this Array.

The last Row from the txtary is found by using the Userobject GettxtAry
to retrieve the txtAry and then the insert function is called with the
last row +1 as the repline value.


void commit void
----------------
Accesses TxtAry Property and prints out this array as a CSV File into
the file with the path from the Path Property.

The path of the CSV file is called through the object property and the
Number of Rows and Columns of the array containing old and new data are
passed in with the array data itself, the array data is then written
element by element with a comma in between each.  When the array comes
to a new row the file writes to a new line.  The NewFile flag is checked
and if TRUE then 1 line only is written to the new file.


integer <NRecords> connect integer <NFields>
--------------------------------------------
input   NFields         number of fields expected to extract.  Note this
                        can be more ( others ignored ) or less ( extra
                        blank fields returned )than that actually in the
                        file.
output  NRecords        returns the number of lines in the file.  Note
                        that heading line(s), if in the file, are also
                        included in the count.

Need to set the Path property first.  Uses the CheckPath Object to create
a new file if the path in Path property does not exist.  This method reads
the file into the TxtAry property which is NRecords by NFields big.  Sets
ConnFlag when complete.


void createObject text <ObjectName>
-----------------------------------
input   ObjectName      text name of object given by calling function

Standard object creation for use within the VEE Object Libraries.


Text[] <RepLine> delete void
-------------------------------------
input   RepLine         an integer value of the line in the txtAry to
                        be deleted. 0 = 1st row of TxtAry

Delete receives the TxtAry from the Userobject getTxtAry and copies all
the data except the line to be deleted to an array with one line less
this array is then re-assigned back to the original txtAry using the
SettxtAry Userobject.


void deleteObject void
----------------------
Standard object deletion for within the VEE Object Libraries but an
added part to close the CSV file if it was sucessfully opened.


Text[] <New Data> <RepLine> insert void
------------------------------------------------
input   RepLine         an integer value of the line in the txtAry for 
                        the new data to be inserted.  0 = 1st row of
                        TxTAry
input   NewData         a one dimensional text array containing the new
                        data to be inserted into the current array.             

Insert gets the txtAry by using the UserObject getTxtAry to retreive it
and copies it into an array one row bigger and inserts the new
data into the line specified by Repline.  This new array is then re-
assigned back to the txtAry using the SettxtAry Userobject.


Text[] <New Data> <RepLine> replace void
-------------------------------------------------
input   RepLine         an integer value of the line in the txtAry for 
                        the new data to replace.
input   NewData         a one dimensional text array containing the new
                        data to replace the line in the current array.
                        
Replace copies the new data into the txtAry retrieved by getTxtAry
straight over the line to be replaced and then re-assigns that array
back to the txtAry using the SettxtAry Userobject.

(c) Michael J. Watts Consultant 2000
